import React, { Component } from 'react';
import DemoC1 from './child'
class DemoP1 extends Component {
    state = { 
        price:19999
     } 
    updatePrice=(price)=>{
        // 更新视图
        this.setState({
            price
        })
    }
    render() { 
        return (<div>
            <h3>7.2子组件给父子组件传值</h3>
            <p>父组件</p>
            当前苹果13价格为：{this.state.price}
            <DemoC1 updatePrice={this.updatePrice} price={this.state.price}/>
        </div>);
    }
}
 
export default DemoP1;